﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace CaclForm
{
    public partial class CaclScore : Form
    {
        public CaclScore()
        {
            InitializeComponent();
        }

        private void openFileDialog1_FileOk(object sender, CancelEventArgs e)
        {

        }

        private void btnExport_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog1 = new OpenFileDialog();
            openFileDialog1.Title = "C# Corner Open File Dialog";
            openFileDialog1.InitialDirectory = @"c:\";
            openFileDialog1.Filter = "|*.xls*|*.xlsx* ";
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                textBox1.Text = System.IO.Path.GetFileNameWithoutExtension(openFileDialog1.FileName);
                //System.IO.Path.GetFullPath(openFileDialog1.FileName); //绝对路径
                //System.IO.Path.GetExtension(openFileDialog1.FileName); //文件扩展名
                //System.IO.Path.GetFileNameWithoutExtension(openFileDialog1.FileName); //文件名没有扩展名
                //System.IO.Path.GetFileName(openFileDialog1.FileName); //得到文件
                //System.IO.Path.GetDirectoryName(openFileDialog1.FileName); //得到路径
            }
        }
    }
}
